public class test {
    public static void main(String[] args) {
       int [] a = {2,7,11,15};
        int [] b = twoSum(a,9);
        for (int i : b) {
            System.out.println(i);
        }


    }
    public  static int[] twoSum(int[] nums , int target){
        int a = 0;
        int[] resut = new int[2];
        for (int i = 0; i < nums.length; i++) {
            if (target == nums[a]+nums[i]){
                resut[0]=a;
                resut[1]=i;
            }else {
                a++;
            }
        }
        return resut;
    }

}
